public class OverloadEqual {
        public static void main(String[] args){
            byte b1 = 1,b2 = 2;
            short s1 = 3,s2 = 4;
            int i1 = 5,i2 = 5;
            long l1 = 2300000000L,l2 = 24000000000L;

            equal(b1,b2);
            equal(s1,s2);
            showResult(equal(i1,i2));//优化后
            equal(l1,l2);
        }
        /*
        优化 复用性极高
        public static boolean equal(byte a,byte b){
            return a == b;
        }
        public static boolean equal(int a,int b){
            return a == b;
        }
        public static boolean equal(short a,short b){
            return a == b;
        }
        public static boolean equal(long a,long b){
            return a == b;
        }
        */
        //优化后
        public static void showResult(boolean b){
            if(b){
                System.out.println("两数相等");
            }else System.out.println("两数不等");
        }
        public static boolean equal(int i1,int i2){
            return i1 == i2;
        }

        //原代码
        public static void equal(byte b1,byte b2){
            if(b1 == b2){
                System.out.println("两数相等");
            }else System.out.println("两数不等");
        }

        public static void equal(short s1,short s2){
            if(s1 == s2){
                System.out.println("两数相等");
            }else System.out.println("两数不等");
        }

        public static void equal(long l1,long l2){
            if(l1 == l2){
                System.out.println("两数相等");
            }else System.out.println("两数不等");
        }

}
